<template>
    <div class="bigbox">
        <div :class="['kuangbox', isShow ? 'button-height' : '']">
            <div v-for="i in arr" :key="i.name">
                <!-- <el-popover
                    placement="top-start"
                    width="200"
                    trigger="hover"
                    :content="i.name"
                >
                    <div slot="reference">{{ i.name }}</div>
                </el-popover> -->
                <el-tooltip
                    class="item"
                    effect="dark"
                    :content="i.name"
                    placement="top"
                    :offset="-55"
                >
                    <div>{{ i.name }}</div>
                </el-tooltip>
            </div>
        </div>
        <div class="xiala" @click="unfold">{{ xialaData }}</div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            isShow: false,
            xialaData: "︾",
            arr: [
                {
                    name: "1",
                },
                {
                    name: "2",
                },
                {
                    name: "3",
                },
                {
                    name: "4",
                },
                {
                    name: "5",
                },
            ],
        };
    },
    methods: {
        /**
         * 收起/展开按钮点击事件
         */
        unfold() {
            this.isShow = !this.isShow;
            this.xialaData = this.isShow ? "︽" : "︾";
        },
    },
};
</script>

<style lang="less">
.kuangbox {
    width: 200px;
    height: 200px;
    background-color: azure;
    border: 1px solid;
    transition: height 0.3s ease;
    overflow: hidden;
}

.button-height {
    background-color: rgb(141, 184, 184);
    height: 500px;
}

.xiala {
    width: 200px;
    height: 20px;
    text-align: center;
    border: 1px solid;
    line-height: 20px;
    background-color: azure;
    cursor: pointer;
}
.box {
    width: 400px;

    .top {
        text-align: center;
    }

    .left {
        float: left;
        width: 60px;
    }

    .right {
        float: right;
        width: 60px;
    }

    .bottom {
        clear: both;
        text-align: center;
    }

    .item {
        margin: 4px;
    }

    .left .el-tooltip__popper,
    .right .el-tooltip__popper {
        padding: 8px 10px;
    }
}
</style>
